#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main(void)
{
	int i = 0;
	char ch = 0;
	while ((ch = getchar()) != '#')
	{
		if (ch == '.')
		{
			ch = '!';
			putchar(ch);
			i++;
		}
		else if (ch == '!')
		{
			printf("!!");
			i++;
		}
		else
			putchar(ch);
	}
	printf("%d\n", i);

	return 0;
}